<template>
	<view class="systemInfo">
		<view class="infoItem" v-for="(item,index) in infoArr" :key="index">
			<view class="hiddenTwoline font14 infoCon">{{item.txt}}</view>
			<view class="font12 color666 infoTime">{{item.createTime}}</view>
		</view>
		<uni-nodata v-if="infoArr.length==0"></uni-nodata>
	</view>
</template>

<script>
	import { messSysList,messSysReadOper } from "@/api/mine.js"
	export default {
		data() {
			return {
				infoArr:[],
				page:1,
				pageSize:20,
				pageTotal:0,
			};
		},
		onLoad() {
			this.allReadClick()
			this.getList()
		},
		methods:{
			initPage(){
				this.page=1;
				this.infoArr=[]
			},
			getList(){
				let param={
					page:this.page,
					size:this.pageSize,
				}
				messSysList(param).then((res)=>{
					if(res.code==100000){
						console.log('列表',res)
						this.infoArr=this.infoArr.concat(res.data.rows)
						this.pageTotal=Math.ceil(res.data.total/this.pageSize)
					}
				})
			},
			// 已读
			allReadClick(){
				let param={
					isAll:true,
					ids:[]
				}
				messSysReadOper(param).then((res)=>{
					if(res.code==100000){
					}
				})
			},
		},
		onPullDownRefresh() {
			this.initPage()
			this.getList()
			setTimeout(()=>{
				uni.stopPullDownRefresh()
			},1000)
		},
		onReachBottom() {
			if(this.page<this.pageTotal){
				++this.page
				this.getList()
			}else{
				uni.showToast({
					title:'我也是有底线的',
					icon:'none'
				})
			}
		}
	}
</script>
<style lang="scss">
page{
	background: $pageBgColor;
}
</style>
<style lang="scss" scoped>
.systemInfo{
	// padding: 30rpx;
	// box-sizing: border-box;
	.infoItem{
		background:#fff;
		padding: 30rpx;
		box-sizing: border-box;
		margin:0 0 20rpx;
		.infoCon{
			margin:0 0 20rpx;
		}
		.infoTime{
			text-align: right;
		}
	}
}
</style>
